extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "奥西里斯"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 4.5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 3                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 7                 # 魔法攻击（每点代表13.7）
	attCoe.def = 3.5                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dang" 
	xb = "神秘"
	lv = 4
	addSkillTxt("[color=#C0C0C0]奥西里斯只能获取一个[/color]")
	addSkillTxt("[冥王沼泽]生成沼泽攻击目标，造成90%神秘系魔法伤害，目标在<沼泽>里挣扎3秒[CD:7]")
	addSkillTxt("[幻乱之光]用幻乱魔法攻击目标，造成120%光系魔法伤害，<混乱>敌军3秒，提升魔攻10%，最高至60%\n若目标深陷<沼泽>，则回合内提升魔攻30点[CD:9]")
	addSkillTxt("[死亡神谕]我将向冥王宣誓忠诚！自身阵亡时获得<神谕>")
	addCdSkill("mwzz",7)
	addCdSkill("hlzz",9)
	addSkillTxt("[color=#FFFF00][诅咒审判][/color][color=#FFCC22]用诅咒审判敌方全体，造成180%神秘系魔法伤害，附带<诅咒><混乱>3秒，并让所有敌人减益层数翻倍[CD:16][/color]")
	addCdSkill("zzsp",16)
	addSkillTxt("[color=#000079]一念别[/color]·[color=#004b97]古[/color][color=#0066cc]神[/color][color=#0080ff]信[/color][color=#46a3ff]仰[/color]-[color=#00BBFF]光明教皇在场时，冥王的力量会被压制，死亡神谕队友承担的伤害降低至60%[/color]")
	
var ynb = 0
var sy = 0
func _onBattleStart():
	._onBattleStart()
	sy = 0
	ynb = 0
	for i in getAllChas(2):
		if i.chaName.find("光明教皇") > -1:
			ynb = 1

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "mwzz":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("冥王沼泽", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.mgiAtk*0.9,Chara.HurtType.MGI,Chara.AtkType.SKILL)
		aiCha.addBuff(bf.zhaoze.new(3))
	if id == "hlzz":
		var b:Buff = aiCha.hasBuff("zhaoze")
		var b1 = hasBuff("mogong1")
		var b2 = hasBuff("huan")
		if b !=null:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("幻乱魔术", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			typeHurtCha(aiCha,att.mgiAtk*1.2,Chara.HurtType.MGI,Chara.AtkType.SKILL,"光")
			aiCha.addBuff(bf.hunluan.new(3))
			if b1 == null:
				addBuff(bf.mogong1.new())
			elif b1.att.mgiAtkL < 0.6:
				b1.att.mgiAtkL += 0.1
			if b2 == null:
				addBuff(huan.new())
			else:
				b2.att.mgiAtk += 30
	if id == "zzsp":
		var chas = getAllChas(1)
		for i in chas:
			var eff = sys.newEff("numHit", position, false, 1)
			eff.setText("诅咒审判", "#FF0099")
			eff.anim.set_speed_scale(0.2)
			typeHurtCha(i,att.mgiAtk*1.8,Chara.HurtType.MGI,Chara.AtkType.SKILL)
			i.addBuff(bf.zuzhou.new(3))
			i.addBuff(bf.hunluan.new(3))
			for j in i.buffs:
				if j.life != null && j.life > 0 and j.isNegetive:
					j.life = min(20, j.life*2)


func _onDeath(atkInfo):
	._onDeath(atkInfo)
	var chas=getAllChas(2)
	for i in chas:
		if chas.size()>1:
			isDeath = false
			sy = 1
		else:
			sy = 0

func _onHurt(atkInfo:AtkInfo):
	._onHurt(atkInfo)
	if sy == 1 && ynb == 0:
		var chas=getAllChas(2)
		if chas.size()>1:
			var cha=sys.rndListItem(chas)
			if cha==self:return
			cha.typeHurtCha(cha,atkInfo.hurtVal* 1,Chara.HurtType.REAL,Chara.AtkType.EFF)
	elif sy == 1 && ynb == 1:
		var chas=getAllChas(2)
		if chas.size()>1:
			var cha=sys.rndListItem(chas)
			if cha==self:return
			cha.typeHurtCha(cha,atkInfo.hurtVal* 0.6,Chara.HurtType.REAL,Chara.AtkType.EFF)

class huan:
	extends Buff
	func _init():
		attInit()
		isNegetive=false
		var dispelable = true
		id = "huan"	
		att.mgiAtk += 30